﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace FrontEnd.Models
{
	public class ListSinglePage<T> : ReadOnlyCollection<T>
	{
		public ListSinglePage(IEnumerable<T> source, int currentPage, int pageCount, int pageSize)
			: base((source ?? new List<T>()).ToList()) // NOTE This is Sparta!..
		{
			this.CurrentPage = currentPage;
			this.PageCount = pageCount;
			this.PageSize = pageSize;
		}

		public int CurrentPage
		{
			get; 
			private set;
		}

		public int PageCount
		{
			get; 
			private set;
		}

		public int PageSize
		{
			get;
			private set;
		}
	}
}